package day17.feifei.wangyunfei;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Deno04 {
    public static void main(String[] args) throws IOException {
        List<String> list=new ArrayList<>();
        Scanner sc=new Scanner(System.in);
        String str;
        while (!(str=sc.nextLine()).equalsIgnoreCase("end")){
            list.add(str);
        }
        File file=new File("D:\\file\\io\\data.txt");
        FileWriter fw=new FileWriter(file);
        FileReader fr=new FileReader(file);
        BufferedWriter bw=new BufferedWriter(fw);
        BufferedReader br=new BufferedReader(fr);

        for (String s : list) {
            bw.write(s);
            bw.newLine();
        }
        bw.flush();
        bw.close();
        fw.close();
        String str1;
        while ((str1=br.readLine())!=null){
            System.out.println(str1);
        }

    }
}
